<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
	<?php include("menucontenttop.php");?>
	<table border="0" cellpadding="5" cellspacing="0" width="100%">
		<tr>
		<?php
			/*$id = $_GET['id'];
			$querycat1 = "select * from categories where id=$id";
			$resultcat1=mysql_query($querycat1);
			 while($rowcat1=mysql_fetch_array($resultcat1)){?>
				<td class="sp_home_title" width="100%">
					<?php echo $rowcat1['cateName'];?> >> SẢN PHẨM MỚI
				</td>
				<?php
				}*/
				?>
			<td class="sp_home_title" width="100%">All Files</td>
		</tr>
	</table>
	<table cellspacing="2" cellpadding="0"  class="sp_home" align="left" width="100%">
		<tr>
			<?php
			$querypaging = "SELECT * FROM productdetails";
			$resultpaging = mysql_query($querypaging);
			$total = mysql_num_rows($resultpaging);
			$perPage = 10;
			$numOfPage = ceil($total/$perPage);
			
			if($_GET['pa'] =="")
			{
				$x = 0;
			}
			else
			{
				$x = ($_GET['pa'] - 1) * $perPage;
			}
			
			$id = $_GET['id'];
			$querypro = "select * from productdetails where state='on' ORDER BY id DESC LIMIT $x,$perPage";
			$resultpro=mysql_query($querypro);
			$a=1;
			while($rowpro = mysql_fetch_array($resultpro)){?>
			<td height="100%" align="center" valign="top">
				<div class="sp_moi_content">
				
				<div class="khung_sp_tc_main">
					<table border="0" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<td class="content-box" width="100%">
								<div align="left" ><a href="index.php?page=listviewproductDetail&id=<?php echo $rowpro['id'];?>" ><?php echo $rowpro['productname'];?></a></div>
							</td>
						</tr>
						<tr>
							<td class="content-second" width="100%"><?php echo $rowpro['productDetail'];?></td>
						</tr>
						<tr>
							<td class="date_created">Ngày tạo : <?php $ngay = date('d/m/Y', $row['dateCreated']); echo $ngay;?>  -  <span class="view-detail-download"><a href="index.php?page=listviewproductDetail&id=<?php echo $rowpro['id'];?>" >Xem chi tiết tải về</a></span> - Lượt tải về : <?php echo $rowpro['download'];?> - Lượt xem : <?php echo $rowpro['productView'];?></td>
						</tr>
						<tr>
							<td align="center" valign="bottom" width="100%">
							
							<!--<div class="luotxem">Lượt xem : <?php echo $row['productView'];?></div>-->
							</td>
						</tr>
						<tr>
							<td align="center" valign="bottom" width="100%" height="10%">
								 <!--<input type="button" value="Mua hàng" onclick="addtocart(<?=$row['id']?>)" />-->
							</td>
						</tr>
					</table>
				</div>
				</div>
			</td>
			<div style="display:none;" id="<?php echo $row['id'];?>"><?php echo $row['productDetail'];?></div>
			 <?php
			if($a%1==0){
				echo "<tr></tr>";	
			}
			$a=$a+1;
		   }
			?>
			
		</tr>
		<tr>
			<td colspan="3" align="center">
				<?php
					if($_GET['pa'] > 1)
					{
						$lui = $_GET['pa'] - 1;
						echo " <a href='index.php?page=allfile&pa=$lui'>Trang trước</a> ";
					}
					
					for($i=1;$i<=$numOfPage;$i=$i+1)
					{
						if($_GET['pa'] == $i)
						{
							echo "<span class=\"paging\"><a href='index.php?page=allfile&pa=$i'>".$i."</a></span> | ";	
						}
						else
						{
							echo "<a href='index.php?page=allfile&pa=$i'>".$i."</a> | ";			
						}
					}
					if($_GET['pa'] < $numOfPage)
					{
						$tien = $_GET['pa'] + 1;
					}
					else
					{
						$tien = 1;	
					}
					echo " <a href='index.php?page=allfile&pa=$tien'>Trang sau</a>";
				?>
			</td>
		</tr>
	</table>
</body>
</html>
